home *** CD-ROM | disk | FTP | other *** search
- <%@ Language=VBScript %>
- <%' (c) Copyright 1999-2004 PaperCut Software Pty. Ltd. %>
- <!-- #INCLUDE FILE="includes/PCCommon.inc" -->
- <!-- #INCLUDE FILE="includes/header.inc" -->
- <%
-
-
- Dim objPCWebUsers
- Set objPCWebUsers = Server.CreateObject("PCWebAdmin.PCWebUsers")
- If objPCWebUsers.Error Then
- WriteErrorMessage objPCWebUsers.ErrorDescription
- End If
-
-
- Function GetChargeError(intError)
- Dim s
-
- If intError = 0 Then
- ' No error
- s = ""
- ElseIf intError = 3 Then
- s = GetText("ErrorTransInvAmount")
- ElseIf intError = 4 Then
- s = GetText("ErrorUnexpectedError")
- s = s & " - " & objPCWebUsers.ErrorDescription
- End If
-
- GetChargeError = s
- End Function
-
- Dim blnIsValidUser
- Dim strChargeUser
- Dim strCreditText
- Dim strComment
- Dim strCharge
- Dim intRow
- strChargeUser = LCase(Trim(Request("txtChargeUser")))
- strComment = Trim(Request("txtAdditionalComment"))
- strCharge = Trim(Request("cboCharge"))
-
- Dim curAmount
- If (IsNumeric(Trim(Request("txtAmount")))) then
- curAmount = CCur(Trim(Request("txtAmount")))
- End If
-
-
-
- If strChargeUser <> "" Then
- objPCWebUsers.SeekUser(strChargeUser)
- If (UCase(objPCWebUsers.UserName) = UCase(strChargeUser)) then
- blnIsValidUser = True
- strCreditText = objPCWebUsers.CreditText
- End If
- End If
-
-
- If Request("blnSubmitted") <> "" Then
- Dim strFullComment
-
- If strCharge = "ChargeTypeOther" Then
- strFullComment = GetText("ChargeTypeOther")
- Else
- strFullComment = strCharge
- End If
-
- If strComment <> "" Then
- strFullComment = strFullComment & " - " & strComment
- End If
-
- objPCWebUsers.SeekUser(strChargeUser)
- If (UCase(objPCWebUsers.UserName) <> UCase(strChargeUser)) then
- ' No match.
- WriteErrorMessage GetTextReplace("ErrorCantFindUser", Array(strChargeUser))
- Else
- ' Charge
- If objPCWebUsers.ChargeUser(curAmount, strFullComment) Then
- RedirectWithMessage "UserList.asp?strUsername=" & Server.URLEncode(strChargeUser), GetText("ChargeApplied")
- Else
- WriteErrorMessage GetText("UnableToCharge") & " " & GetChargeError(objPCWebUsers.ProcessErrorNo)
- End If
- End If
- End If
- %>
- <h1><%=GetText("OtherCharges")%></h1>
- <%
- ' Find the details of the user
-
- WriteUserAdminLinks strChargeUser
- %>
-
-
- <FORM ACTION="OtherCharges.asp" METHOD="GET" id="chargesForm" name="chargesForm">
- <INPUT type="hidden" name="blnSubmitted" value="T">
-
- <TABLE class="webAdmin" width="550">
- <% If blnIsValidUser Then %>
- <TR class="<%=RowClassHelper(intRow)%>">
- <TH width="45%"><%=GetText("UserToCharge")%>:</TH>
- <TD>
- <%=Server.HTMLEncode(strChargeUser)%>
- <INPUT type="hidden" name="txtChargeUser" value="<%=Server.HTMLEncode(strChargeUser)%>">
- <BR><a class="mouse" href="OtherCharges.asp">(<%=GetText("ChargeDiffUser")%>)</a>
- </TD>
- </TR>
- <% intRow = intRow + 1 %>
- <TR class="oddRow">
- <TH><%=GetText("AvailableCredit")%>:</TH>
- <TD>
- <%=Server.HTMLEncode(strCreditText)%>
- </TD>
- </TR>
- <% Else %>
- <TR class="<%=RowClassHelper(intRow)%>">
- <TH width="45%"><%=GetText("UserToCharge")%>:</TH>
- <TD>
- <INPUT type="text" size="20" name="txtChargeUser" value="<%=Server.HTMLEncode(strChargeUser)%>">
- </TD>
- </TR>
- <%
- End If
- intRow = intRow + 1
- %>
-
-
- <TR class="<%=RowClassHelper(intRow)%>">
- <TH><%=GetText("Amount")%>:</TH>
- <TD>
- <INPUT type="text" size="10" name="txtAmount" value="<%= Server.HTMLEncode(FormatCredit(0)) %>">
- </TD>
- </TR>
- <% intRow = intRow + 1 %>
- <TR class="<%=RowClassHelper(intRow)%>">
- <TH><%=GetText("ChargeType")%>:</TH>
- <TD>
- <SELECT name="cboCharge">
- <%
- If strCharge = "ChargeTypeOther" Then
- Response.Write "<OPTION value=""ChargeTypeOther"" SELECTED>" & GetText("ChargeTypeOther") & "</OPTION>" & vbcrlf
- Else
- Response.Write "<OPTION value=""ChargeTypeOther"">" & GetText("ChargeTypeOther") & "</OPTION>" & vbcrlf
- End If
-
- Dim i
- Dim strChargeTypeKey, strChargeTypeText
- If IsArray(garrChargeTypes) Then
- For i = LBound(garrChargeTypes) to UBound(garrChargeTypes)
- If strCharge = garrChargeTypes(i) Then
- Response.Write vbTab & "<OPTION SELECTED>" & HTMLEncodeIfRequired(garrChargeTypes(i)) & "</OPTION>" & vbCRLF
- Else
- Response.Write vbTab & "<OPTION>" & HTMLEncodeIfRequired(garrChargeTypes(i)) & "</OPTION>" & vbCRLF
- End If
- Next
- Else
- i = 0
- strChargeTypeKey = "OtherChargeType" & CStr(i)
- Do While HasText(strChargeTypeKey)
- strChargeTypeText = GetTextNoEncode(strChargeTypeKey)
- If strCharge = strChargeTypeText Then
- Response.Write vbTab & "<OPTION SELECTED>" & HTMLEncodeIfRequired(strChargeTypeText) & "</OPTION>" & vbCRLF
- Else
- Response.Write vbTab & "<OPTION>" & HTMLEncodeIfRequired(strChargeTypeText) & "</OPTION>" & vbCRLF
- End If
- i = i + 1
- strChargeTypeKey = "OtherChargeType" & CStr(i)
- Loop
- End If
-
- %>
- </SELECT>
- </TD>
- </TR>
- <% intRow = intRow + 1 %>
- <TR class="<%=RowClassHelper(intRow)%>">
- <TH><%=GetText("AdditionalComment")%>:</TH>
- <TD>
- <INPUT type="text" size="50" name="txtAdditionalComment" maxlength="255" value="<%=Server.HTMLEncode(strComment)%>">
- </TD>
- </TR>
- <% intRow = intRow + 1 %>
-
- <TR class="evenRow">
- <TD align=right colspan=2>
- <INPUT type="submit" value="<%=GetText("ChargeUser")%>" name=cmdSave>
- </TD>
- </TR>
-
- </TABLE>
- </FORM>
- <%
- WriteUserAdminLinks strChargeUser
-
- Set objPCWebUsers = Nothing
- %>
- </CENTER>
- <!-- #INCLUDE FILE="includes/footer.inc" -->
-